<template>
	<div>
		
		<div class="main">
			<div class="content">
				<view class="title"><text style="padding-left: 10px;">发布推广信息>></text></view>
				<view class="item">
					<text>APP名字</text><input maxlength="15" v-model="appName" class="inputView"
						placeholder="请输入app名字" />
				</view>
				<view class="item">
					<text>推广单价</text><input maxlength="4" v-model="appPrice" class="inputView" placeholder="请输入推广单价" />
				</view>
				<view class="item">
					<text>微信号码</text><input maxlength="20" v-model="wx" class="inputView" placeholder="请输入微信号码" />
				</view>
				<view class="item">
					<text>QQ号码</text><input maxlength="20" v-model="qq" class="inputView" placeholder="请输入QQ号码" />
				</view>
				<view class="item">
					<text>手机号码</text><input maxlength="11" v-model="phone" class="inputView" placeholder="请输入手机号码" />
				</view>
				<view class="item">
					<text>所属类型</text>
					<select class="inputView" v-model="kind">
						<option value="1">个人</option>
						<option value="2">公司</option>
						<option value="3">联盟</option>
						<option value="4">其他</option>
					</select>
				</view>
				<view class="item">
					<text>数据查看</text>
					<select class="inputView" v-model="ck">
						<option value="1">截图</option>
						<option value="2">后台</option>
						<option value="3">其他</option>
					</select>
				</view>

				<view class="item">
					<text>操作系统</text>
					<select class="inputView" v-model="xt">
						<option value="1">安卓系统</option>
						<option value="2">IOS系统</option>
						<option value="3">PC软件</option>
					</select>
				</view>

				<view class="item">
					<text>结算方式</text>
					<select class="inputView" v-model="fs">
						<option value="1">日结</option>
						<option value="2">周结</option>
						<option value="3">月结</option>
						<option value="4">其他</option>
					</select>
				</view>
				<view class="item">
					<text>单子类型</text>
					<select class="inputView" v-model="dzlx">
						<option value="0">全部</option>
						<option value="10">纯注册</option>
						<option value="20">app拉新</option>
						<option value="30">实名绑卡</option>
						<option value="40">自然量</option>
						<option value="50">其他</option>
					</select>
				</view>
				<view class="item">
					<text>详细需求</text><input v-model="content" class="inputContent" placeholder="请输入详细需求" />
				</view>
				<a class="item1_button" @click="send()">确定发布</a>

			</div>
		</div>

	</div>
</template>

<script>
	
	export default {
		
		data() {
			return {
				datas: [],
				kind: 1,
				ck: 1,
				xt: 1,
				fs: 1,
				dzlx: 0,
				appName: null,
				appPrice: null,
				wx: null,
				qq: null,
				phone: null,
				content: null,

			}
		},
		props: {
			msg: String
		},
		mounted() {
			this.qq=this.$PublicData.UserData.qq;
			this.wx=this.$PublicData.UserData.wx;
			this.phone=this.$PublicData.UserData.phone;
			

		},

		methods: {
			async send() {
				var cp = {
					CHANPIN_APPMINGZI: this.appName,
					CHANPIN_APPJIAGE: this.appPrice,
					CHANPIN_CZXT: this.xt,
					CHANPIN_JSFS: this.fs,
					CHANPIN_SJCK: this.ck,
					CHANPIN_SSLX: this.kind,
					CHANPIN_QQHM: this.qq,
					CHANPIN_WXHM: this.wx,
					CHANPIN_SJHM: this.phone,
					CHANPIN_BZ: this.content,
					cp_type: this.dzlx,
					USER: this.$PublicData.getUserdata().userName,
					CHANPIN_APPUSERID: this.$PublicData.getUserdata().uid,
				}
				if (!this.$Utils.checkAddCpData(cp)) {
					return;
				}
				try {
					const res = await this.$postData({
						url: this.$apis.addCp,
						data: cp
					})
					uni.showToast({
						title: "发布成功",
						success:function(){
							uni.$emit('updateSize', 1);
							setTimeout(function(){
								 uni.redirectTo({
								 	url: '../main/MainView'
								 })
							}, 1000, null);
						}
					})

				} catch (e) {
					console.log("eee: ", e);
					this.$Utils.showToast("发布失败：" + e);
				}
			},

		}


	}
</script>

<style>
	.main {
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.title {
		line-height: 45px;
		width: 100%;
		height: 45px;
		background: #E5E5E5;
		color: #000000;
	}

	.content {
		border: 1px solid #E5E5E5;
		align-items: center;
		flex-direction: column;
		width: 1200px;
		min-height: 950px;
		display: flex;
	}

	.item {
		margin-top: 10px;
		align-items: center;
		display: flex;
		min-height: 45px;
	}

	.inputView {
		padding-left: 10px;
		margin-left: 30px;
		height: 40px;
		width: 600px;
		border: 1px solid #E5E5E5;
	}

	.inputContent {
		text-align: start;
		padding-left: 10px;
		margin-left: 30px;
		height: 120px;
		width: 600px;
		border: 1px solid #E5E5E5;
	}

	.item1_button {
		letter-spacing: 0.2rem;
		margin-top: 0.8125rem;
		font-size: 1rem;
		width: 18.875rem;
		border: 0.0625rem solid #F99B15;
		border-radius: 0.3125rem;
		text-align: center;
		justify-content: center;
		align-items: center;
		display: flex;
		height: 2.5rem;
		background: #F99B15;
		color: #FFFFFF;
	}
</style>
